package cn.readjava.service.impl;

import cn.readjava.bean.Video;
import cn.readjava.dao.VideoDao;
import cn.readjava.service.VideoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VideoServiceImpl implements VideoService {

    @Resource
    private VideoDao videoDao;

    @Override
    public void delete(Long id) {
        videoDao.deleteById(id);
    }

    @Override
    public Video save(Video video) {
        return videoDao.save(video);
    }

    @Override
    public Video getOne(Long id) {
        return videoDao.getOne(id);
    }

    @Override
    public List<Video> findByTypeId(Long id) {
        return videoDao.findAllByVideoTypeId(id);
    }
}
